package com.wst.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@RequestMapping("/test")
public class TestController {

    @PostMapping("/interface")
    @ResponseBody
    public String test1(){
        System.out.println("--------111--------");
        return "interface测试：success";
    }
    /**
     * 测试restful风格接口-get
     */
    @RequestMapping(value="/restful/{name}",method= RequestMethod.GET)
    @ResponseBody
    public String getRestfulTest(@PathVariable(name = "name") String name){
        System.out.println("--------222--------");
        return "get请求restful测试：success，name为："+ name;
    }
    /**
     * 测试restful风格接口-post
     */
    @RequestMapping(value="/restful/{name}",method= RequestMethod.POST)
    @ResponseBody
    public String postRestfulTest(@PathVariable(name="name") String name){
        System.out.println("--------333--------");
        return "post请求restful测试：success，name为：" + name ;
    }
}
